package gaml.text;

import gaml.text.parser.AliasNodeParser;
import gaml.text.parser.EmptyNodeParser;
import gaml.text.parser.MappingNodeParser;
import gaml.text.parser.ScalarNodeParser;
import gaml.text.parser.SequenceNodeParser;
import gaml.yaml.ahchor.YamlAnchorCodeStore;

/**
 * create new text parsers collection, with initial set of parsers 
 * @author shnireck
 *
 */
public class DefaultParserStoreFactory {
	
	/**
	 * return new yaml text parsers with basic node
	 * parsers
	 * @param anchors anchor-code based yaml anchors store
	 * @return new yaml text parsers store
	 */
	public static YamlParserStore getStore (YamlAnchorCodeStore anchors) {
		YamlParserStore store = new YamlParserStore (new EmptyNodeParser ());
		
		store.register (new AliasNodeParser (anchors));
		store.register (new ScalarNodeParser (anchors));
		store.register (new SequenceNodeParser (anchors, store));
		store.register (new MappingNodeParser (anchors, store));
		
		return store;
	}
}
